package servlet;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

@WebServlet("/newsdetail.html")
public class NewsDetaServlet extends HttpServlet {
    @Override
    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
        String NewsID = request.getParameter("NewsID");
        int newsID = Integer.parseInt(NewsID);
        News news = (new NewsDao()).getNewsById(newsID);
        request.setAttribute("title", news.getNewstitle());
        request.setAttribute("content", news.getNewscontenr());
        request.getRequestDispatcher("front/newsFrontDetail.jsp").forward(request, response);
    }
}
